package cn.gson.springmvc.model.pojos;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Objects;

@Entity
@Table(name = "publicdurg_details", schema = "jinsanjiao", catalog = "")
public class PublicdurgDetails {
    private int pdDetailsId;
    private Long pdDetailsShuliang;
    private Timestamp pdDetailsDate;
    private Inventory inventoryByInventoryNumber;
    private Publicdurg publicdurgByPublicdurgId;

    @Id
    @Column(name = "pd_details_id", nullable = false)
    public int getPdDetailsId() {
        return pdDetailsId;
    }

    public void setPdDetailsId(int pdDetailsId) {
        this.pdDetailsId = pdDetailsId;
    }

    @Basic
    @Column(name = "pd_details_shuliang", nullable = true, precision = 0)
    public Long getPdDetailsShuliang() {
        return pdDetailsShuliang;
    }

    public void setPdDetailsShuliang(Long pdDetailsShuliang) {
        this.pdDetailsShuliang = pdDetailsShuliang;
    }

    @Basic
    @Column(name = "pd_details_date", nullable = true)
    public Timestamp getPdDetailsDate() {
        return pdDetailsDate;
    }

    public void setPdDetailsDate(Timestamp pdDetailsDate) {
        this.pdDetailsDate = pdDetailsDate;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        PublicdurgDetails that = (PublicdurgDetails) o;
        return pdDetailsId == that.pdDetailsId &&
                Objects.equals(pdDetailsShuliang, that.pdDetailsShuliang) &&
                Objects.equals(pdDetailsDate, that.pdDetailsDate);
    }

    @Override
    public int hashCode() {
        return Objects.hash(pdDetailsId, pdDetailsShuliang, pdDetailsDate);
    }

    @ManyToOne
    @JoinColumn(name = "inventory_number", referencedColumnName = "inventory_number")
    public Inventory getInventoryByInventoryNumber() {
        return inventoryByInventoryNumber;
    }

    public void setInventoryByInventoryNumber(Inventory inventoryByInventoryNumber) {
        this.inventoryByInventoryNumber = inventoryByInventoryNumber;
    }

    @ManyToOne
    @JoinColumn(name = "publicdurg_id", referencedColumnName = "publicdurg_id")
    public Publicdurg getPublicdurgByPublicdurgId() {
        return publicdurgByPublicdurgId;
    }

    public void setPublicdurgByPublicdurgId(Publicdurg publicdurgByPublicdurgId) {
        this.publicdurgByPublicdurgId = publicdurgByPublicdurgId;
    }
}
